package com.hh.controller;

import com.hh.commonutils.Result;
import com.hh.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.List;

@RestController

@RequestMapping("/eduvod/video")
public class VideoController {
    @Autowired
    private VideoService videoService;
    // 获取播放地址
    @GetMapping("/getPlayInfo/{videoId}")
    public Result getPlayInfo(@PathVariable String videoId){
        HashMap<String, String> map = videoService.getPlayInfo(videoId);
        return Result.success().data("videoUrl", map);
    }

    @PostMapping("/uploadVideo")
    public Result uploadVideo(MultipartFile file){
        String s = videoService.uploadVideo(file);
        return Result.success().data("result", s);
    }

    @DeleteMapping("/deleteUploadVideo/{videoIds}")
    public Result deleteUploadVideo(@PathVariable String videoIds) {
        videoService.deleteUploadVideo(videoIds);
        return Result.success();
    }
}
